package com.demo.controller;

import com.demo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class StudentController {

    //1.使用属性注入的方式获取 Bean
    @Autowired
    private StudentService studentService;

    public void sayHi() {
        //调用service方法
        studentService.sayHi();
    }
}
